package DBTasks;

import java.sql.PreparedStatement;
import java.sql.SQLException;

public class AddEvent extends DBTask {
    private static String insertNewEventQuery = "INSERT INTO Event (Date, Location, Description, Event_Type, Sponsor_Name) values(?, ?, ?, ?, ?)";

    public static boolean addEvent(String date, String location,
            String description, String type, String sponsorName) {
    	//System.out.println(date + " " + location + " " + description + " " + type + " " + sponsorName);
    	
        try {
            PreparedStatement insertNewEvent = con
                    .prepareStatement(insertNewEventQuery);
            insertNewEvent.setString(1, date);
            insertNewEvent.setString(2, location);
            insertNewEvent.setString(3, description);
            insertNewEvent.setString(4, type);
            insertNewEvent.setString(5, sponsorName);
            insertNewEvent.executeUpdate();
            return true;
        }
        catch (SQLException e) {
            e.printStackTrace();
            return false;
        }
    }
}
